class Solution {
public:
    TreeNode* _invertTree(TreeNode* root)
    {
        if(root == nullptr)
        {
            return nullptr;
        }
        _invertTree(root->left);
        _invertTree(root->right);
        TreeNode* tmp = root->left;
        root->left = root->right;
        root->right = tmp;
        return root;
    }
    TreeNode* invertTree(TreeNode* root) {
        //子问题为让我的每一个字节点需要改变我的左子树和右子树
        return _invertTree(root);
    }
};